this.BX=this.BX||{};this.BX.Mobile=this.BX.Mobile||{};this.BX.Mobile.Field=this.BX.Mobile.Field||{};(function(t,e){"use strict";var i=function(){var t=function t(e,i,s){this.click=BX.delegate(this.click,this);this.callback=BX.delegate(this.callback,this);this.multiple=false;this.select=null;this.eventNode=null;this.container=null;this.titles=[];this.values=[];this.defaultTitles=[];this.init(e,i,s)};t.prototype={init:function t(e,i,s){if(BX(e)&&BX(i)&&BX(s)){this.select=e;this.eventNode=i;this.container=s;if(!this.select.hasAttribute("bx-bound")){this.select.setAttribute("bx-bound","Y");BX.addCustomEvent(e,"onChange",BX.delegate(function(){this.multiple=this.select.hasAttribute("multiple");this.initValues()},this));BX.bind(this.eventNode,"click",this.click)}this.multiple=e.hasAttribute("multiple");this.initValues()}},initValues:function t(){this.titles=[];this.values=[];this.defaultTitles=[];for(var e=0;e<this.select.options.length;e++){this.titles.push(this.select.options[e].innerHTML);this.values.push(this.select.options[e].value);if(this.select.options[e].hasAttribute("selected")){this.defaultTitles.push(this.select.options[e].innerHTML)}}},click:function t(e){this.show();return BX.PreventDefault(e)},show:function t(){if(this.titles.length>0){BXMobileApp.UI.SelectPicker.show({callback:this.callback,values:this.titles,multiselect:this.multiple,default_value:this.defaultTitles})}},callback:function t(i){this.defaultTitles=[];if(i&&i.values&&i.values.length>0){var s=[];for(var l=0;l<this.titles.length;l++){for(var n=0;n<i.values.length;n++){if(this.titles[l]===i.values[n]){s.push(this.values[l]);this.defaultTitles.push(this.titles[l]);break}}}var h="";for(var o=0;o<this.select.options.length;o++){this.select.options[o].removeAttribute("selected");if(BX.util.in_array(this.select.options[o].value,s)){this.select.options[o].setAttribute("selected","selected");if(this.multiple){h+=this.select.options[o].innerHTML+"<br>"}else{h=this.select.options[o].innerHTML}}}if(h===""&&!this.multiple){h='<span style="color:grey">'.concat(e.Loc.getMessage("interface_form_select"),"</span>")}this.container.innerHTML=h}else{for(var c=0;c<this.select.options.length;c++){this.select.options[c].removeAttribute("selected")}this.container.innerHTML=""}BX.onCustomEvent(this,"onChange",[this,this.select])}};return t}();window.app.exec("enableCaptureKeyboard",true);BX.Mobile.Field.Enum=function(t){this.init(t)};BX.Mobile.Field.Enum.prototype={__proto__:BX.Mobile.Field.prototype,bindElement:function t(e){var s=null;if(BX(e)){s=new i(e,BX("".concat(e.id,"_select")),BX("".concat(e.id,"_select")))}return s}}})(this.BX.Mobile.Field.Enum=this.BX.Mobile.Field.Enum||{},BX);
//# sourceMappingURL=mobile.map.js